home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / xbtx.lha / Source / TextDisplay.cpp < prev    next >
C/C++ Source or Header  |  1995-12-03  |  14KB  |  507 lines

  1. /*
  2. **    $Id: TextDisplay.cpp 1.7 1995/12/03 12:16:23 olsen Exp olsen $
  3. **
  4. **    :ts=4
  5. */
  6.  
  7. /*
  8.  * Amiga changes copyright © 1995 by Olaf Barthel, All Rights Reserved
  9.  *
  10.  * Copyright (c) 1992, 1993 Arno Augustin, Frank Hoering, University of
  11.  * Erlangen-Nuremberg, Germany.
  12.  * All rights reserved.
  13.  *
  14.  * Redistribution and use in source and binary forms, with or without
  15.  * modification, are permitted provided that the following conditions
  16.  * are met:
  17.  * 1. Redistributions of source code must retain the above copyright
  18.  *    notice, this list of conditions and the following disclaimer.
  19.  * 2. Redistributions in binary form must reproduce the above copyright
  20.  *    notice, this list of conditions and the following disclaimer in the
  21.  *    documentation and/or other materials provided with the distribution.
  22.  * 3. All advertising materials mentioning features or use of this software
  23.  *    must display the following acknowledgement:
  24.  *    This product includes software developed by the University of
  25.  *    Erlangen-Nuremberg, Germany.
  26.  * 4. Neither the name of the University nor the names of its contributors
  27.  *    may be used to endorse or promote products derived from this software
  28.  *    without specific prior written permission.
  29.  *
  30.  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  31.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  32.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  33.  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  35.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  36.  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  37.  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  38.  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  39.  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40.  *
  41.  * This software has not been validated by the ``Bundesamt fuer Zulassungen in
  42.  * der Telekommunikation'' of the ``Deutsche Bundepost Telekom'' and thus
  43.  * must not be used for accessing the BTX-Network of the Telekom in Germany.
  44.  *
  45.  * Diese Software hat keine Zulassung durch das Bundesamt fuer Zulassungen in
  46.  * der Telekommunikation der Deutschen Bundespost Telekom und darf daher nicht
  47.  * am Netz der Deutschen Bundespost Telekom in Deutschland betrieben werden.
  48.  */
  49.  
  50. /****************************************************************************/
  51.  
  52. #include <clib/intuition_protos.h>
  53. #include <clib/graphics_protos.h>
  54. #include <clib/utility_protos.h>
  55. #include <clib/keymap_protos.h>
  56. #include <clib/exec_protos.h>
  57. #include <clib/dos_protos.h>
  58. #include <clib/macros.h>
  59.  
  60. #ifdef __SASC
  61. #include <pragmas/intuition_pragmas.h>
  62. #include <pragmas/graphics_pragmas.h>
  63. #include <pragmas/utility_pragmas.h>
  64. #include <pragmas/keymap_pragmas.h>
  65. #include <pragmas/exec_pragmas.h>
  66. #include <pragmas/dos_pragmas.h>
  67.  
  68. extern struct IntuitionBase *IntuitionBase;
  69. extern struct GfxBase        *GfxBase;
  70. extern struct ExecBase        *SysBase;
  71. extern struct DosLibrary    *DOSBase;
  72. extern struct Library        *KeymapBase;
  73. extern struct Library        *UtilityBase;
  74. #endif    // __SASC
  75.  
  76. #include <string.h>
  77. #include <stdio.h>
  78.  
  79. /****************************************************************************/
  80.  
  81. #ifndef _TEXTDISPLAY_HPP
  82. #include "TextDisplay.hpp"
  83. #endif
  84.  
  85. #ifndef _FONT_H
  86. #include "Font.h"
  87. #endif
  88.  
  89. #ifndef _RAWKEYS_H
  90. #include "RawKeys.h"
  91. #endif
  92.  
  93. /****************************************************************************/
  94.  
  95. #define SPREAD(v) ((((ULONG)v) << 24) | (((ULONG)v) << 16) | (((ULONG)v) << 8) | ((ULONG)v))
  96.  
  97. TextDisplay::TextDisplay()
  98. {
  99.     Window    = NULL;
  100.     Font    = NULL;
  101. }
  102.  
  103. TextDisplay::~TextDisplay()
  104. {
  105.     Close();
  106. }
  107.  
  108. VOID TextDisplay::Close(VOID)
  109. {
  110.     if(Window)
  111.     {
  112.         CloseWindow(Window);
  113.         Window = NULL;
  114.     }
  115.  
  116.     if(Font)
  117.     {
  118.         CloseFont(Font);
  119.         Font = NULL;
  120.     }
  121. }
  122.  
  123. LONG TextDisplay::Open(STRPTR PubScreenName,int XScale,int YScale,BOOL DirectRender)
  124. {
  125.     extern struct GfxBase *GfxBase;
  126.  
  127.     struct TextAttr SystemText;
  128.  
  129.     SystemText.ta_Name    = GfxBase->DefaultFont->tf_Message.mn_Node.ln_Name;
  130.     SystemText.ta_YSize    = GfxBase->DefaultFont->tf_YSize;
  131.     SystemText.ta_Style    = GfxBase->DefaultFont->tf_Style;
  132.     SystemText.ta_Flags    = GfxBase->DefaultFont->tf_Flags;
  133.  
  134.     if(Font = OpenFont(&SystemText))
  135.     {
  136.         FontWidth    = Font->tf_XSize;
  137.         FontHeight    = Font->tf_YSize;
  138.  
  139.         if(Window = OpenWindowTags(NULL,
  140.             WA_DragBar,                TRUE,
  141.             WA_DepthGadget,            TRUE,
  142.             WA_CloseGadget,            TRUE,
  143.             WA_Title,                "xBTX",
  144.             WA_InnerWidth,            40 * FontWidth,
  145.             WA_InnerHeight,            24 * FontHeight,
  146.             WA_RMBTrap,                TRUE,
  147.             WA_IDCMP,                IDCMP_MOUSEBUTTONS | IDCMP_RAWKEY | IDCMP_CLOSEWINDOW,
  148.             WA_Activate,            TRUE,
  149.             WA_AutoAdjust,            FALSE,
  150.             WA_PubScreenName,        PubScreenName,
  151.             WA_PubScreenFallBack,    TRUE,
  152.         TAG_DONE))
  153.         {
  154.             struct DrawInfo *DrawInfo;
  155.  
  156.             if(DrawInfo = GetScreenDrawInfo(Window -> WScreen))
  157.             {
  158.                 FgPen    = DrawInfo -> dri_Pens[TEXTPEN];
  159.                 BgPen    = DrawInfo -> dri_Pens[BACKGROUNDPEN];
  160.  
  161.                 MaxPen    = MAX(FgPen,BgPen);
  162.  
  163.                 RPort = Window->RPort;
  164.  
  165.                 SetFont(RPort,Font);
  166.  
  167.                 SetMaxPen(RPort,MaxPen);
  168.  
  169.                 SetABPenDrMd(RPort,BgPen,0,JAM1);
  170.                 RectFill(RPort,Window->BorderLeft,Window->BorderTop,Window->Width - (Window->BorderRight+1),Window->Height - (Window->BorderBottom+1));
  171.  
  172.                 SetABPenDrMd(RPort,FgPen,BgPen,JAM2);
  173.  
  174.                 WindowPort = Window->UserPort;
  175.                 WindowMask = 1UL << WindowPort->mp_SigBit;
  176.  
  177.                 FreeScreenDrawInfo(Window -> WScreen,DrawInfo);
  178.  
  179.                 ScreenToFront(Window->WScreen);
  180.  
  181.                 return(0);
  182.             }
  183.  
  184.             CloseWindow(Window);
  185.             Window = NULL;
  186.         }
  187.         else
  188.         {
  189.             CloseFont(Font);
  190.             Font = NULL;
  191.         }
  192.     }
  193.  
  194.     return(-1);
  195. }
  196.  
  197. VOID TextDisplay::PutLine(STRPTR Line)
  198. {
  199.     if(Line)
  200.     {
  201.         int i,len;
  202.  
  203.         SetAPen(RPort,BgPen);
  204.         RectFill(RPort,Window->BorderLeft,Window->BorderTop + PutIndex * FontHeight,Window->Width - (Window->BorderRight + 1),Window->BorderTop + (PutIndex + 1) * FontHeight - 1);
  205.         SetAPen(RPort,FgPen);
  206.  
  207.         if((len = (int)strlen(Line)) > 40)
  208.             len = 40;
  209.  
  210.         for(i = 0 ; i < len ; i++)
  211.             xputc(Line[i],0,i,PutIndex,0,0,0,0,7,0);
  212.  
  213.         PutIndex = (WORD)((PutIndex + 1) % (*rows));
  214.     }
  215.     else
  216.     {
  217.         PutIndex = 0;
  218.         xclearscreen();
  219.     }
  220. }
  221.  
  222. void TextDisplay::xputc(int c,int s,int x,int y,int xdouble,int ydouble,int underline,int d,int fg,int bg)
  223. {
  224.    static unsigned char supp_map[96] =
  225.       { ' ', 0xa1, 0xa2, 0xa3, '$', 0xa5, '#', 0xa7, 0xa4, '`', '\"', 0xab,
  226.     0, 0, 0, 0, 0xb0, 0xb1, 0xb2, 0xb3, 0xd7, 0xb5, 0xb6, 0xb7, 0xf7,
  227.     '\'', '\"', 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0, 0x60, 0x27, 0, '~',
  228.     0xaf, 0, 0, 0x22, 0x22, 0xb0, 0, 0, 0x22, 0xb8, 0, 0xad, 0xb9, 0xae,
  229.     0xa9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc6, 0, 0, 0, 0, 0,
  230.     0, 0, 0xd8, 0, 0, 0xfe, 0, 0, 0, 0, 0xe6, 0, 0, 0, 0, 0, 0, 0, 0xf8,
  231.     0, 0xdf, 0xde, 0, 0, 0 };
  232.  
  233.    static unsigned char diacritical_map[26*2][16] = {
  234.     { 0, 0xc0, 0xc1, 0xc2, 0xc3, 0, 0, 0, 0xc4, 0xc4, 0xc5, 0, 0, 0xc4, 0, 0 },
  235.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },     /* B */
  236.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc7, 0, 0, 0, 0 },
  237.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* D */
  238.     { 0, 0xc8, 0xc9, 0xca, 0, 0, 0, 0, 0xcb, 0xcb, 0, 0, 0, 0xcb, 0, 0 },
  239.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  240.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  241.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* H */
  242.     { 0, 0xcc, 0xcd, 0xce, 0, 0, 0, 0, 0xcf, 0xcf, 0, 0, 0, 0xcf, 0, 0 },
  243.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  244.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  245.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  246.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  247.     { 0, 0, 0, 0, 0xd1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* N */
  248.     { 0, 0xd2, 0xd3, 0xd4, 0xd5, 0, 0, 0, 0xd6, 0xd6, 0, 0, 0, 0xd6, 0, 0 },
  249.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  250.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  251.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  252.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  253.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* T */
  254.     { 0, 0xd9, 0xda, 0xdb, 0, 0, 0, 0, 0xdc, 0xdc, 0, 0, 0, 0xdc, 0, 0 },
  255.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  256.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  257.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* X */
  258.     { 0, 0, 0xdd, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  259.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  260.     { 0, 0xe0, 0xe1, 0xe2, 0xe3, 0, 0, 0, 0xe4, 0xe4, 0xe5, 0, 0, 0xe4, 0, 0 },
  261.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  262.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xe7, 0, 0, 0, 0 },  /* c */
  263.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  264.     { 0, 0xe8, 0xe9, 0xea, 0, 0, 0, 0, 0xeb, 0xeb, 0, 0, 0, 0xeb, 0, 0 },
  265.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  266.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  267.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* h */
  268.     { 0, 0xec, 0xed, 0xee, 0, 0, 0, 0, 0xef, 0xef, 0, 0, 0, 0xef, 0, 0 },
  269.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  270.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  271.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  272.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  273.     { 0, 0, 0, 0, 0xf1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* n */
  274.     { 0, 0xf2, 0xf3, 0xf4, 0xf5, 0, 0, 0, 0xf6, 0xf6, 0, 0, 0, 0xf6, 0, 0 },
  275.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  276.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  277.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  278.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  279.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* t */
  280.     { 0, 0xf9, 0xfa, 0xfb, 0, 0, 0, 0, 0xfc, 0xfc, 0, 0, 0, 0xfc, 0, 0 },
  281.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  282.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  283.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  284.     { 0, 0, 0xfd, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0xff, 0, 0 },  /* y */
  285.     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
  286.  
  287.     if(x<0 || y<0 || x>39 || y>(*rows)-1)
  288.         return;
  289.     else
  290.     {
  291.         UBYTE Char;
  292.  
  293.         /* ASCII out of  1st supplementary set of mosaic characters */
  294.         if(s==SUP1 && c>=0x40 && c<=0x5f)
  295.             Char = (UBYTE)c;
  296.         else
  297.             Char = (UBYTE)' ';
  298.  
  299.         /* supplementary set of graphic characters */
  300.         if(s==SUPP && supp_map[c-0x20])
  301.             Char = (UBYTE)supp_map[c-0x20];
  302.         else
  303.         {
  304.             /* composed characters, diacritical marks (page 123) */
  305.             if(s==PRIM)
  306.             {
  307.                 if(!d)
  308.                     Char = (UBYTE)c;  /* ASCII character */
  309.                 else
  310.                 {
  311.                     if(d>=0x40 && d<=0x4f)
  312.                     {
  313.                         if(c>=0x41 && c<=0x5a && diacritical_map[c-0x41][d&0xf])
  314.                             Char = (UBYTE)diacritical_map[c-0x41][d&0xf];
  315.                         else
  316.                         {
  317.                             if(c>=0x61 && c<=0x7a && diacritical_map[c-0x61+26][d&0xf])
  318.                                 Char = (UBYTE)diacritical_map[c-0x61+26][d&0xf];
  319.                         }
  320.                     }
  321.                 }
  322.             }
  323.         }
  324.  
  325.         PutChar(Char,x,y);
  326.  
  327.         if(xdouble)
  328.         {
  329.             PutChar((UBYTE)' ',x + 1,y);
  330.  
  331.             if(ydouble)
  332.             {
  333.                 PutChar((UBYTE)' ',x,y + 1);
  334.                 PutChar((UBYTE)' ',x + 1,y + 1);
  335.             }
  336.         }
  337.         else
  338.         {
  339.             if(ydouble)
  340.                 PutChar((UBYTE)' ',x,y + 1);
  341.         }
  342.     }
  343. }
  344.  
  345. void TextDisplay::xclearscreen()
  346. {
  347.     SetAPen(RPort,BgPen);
  348.     RectFill(RPort,Window->BorderLeft,Window->BorderTop,Window->Width - (Window->BorderRight + 1),Window->Height - (Window->BorderBottom + 1));
  349.     SetAPen(RPort,FgPen);
  350. }
  351.  
  352. void TextDisplay::xcursor(int x,int y)
  353. {
  354.     SetABPenDrMd(RPort,(ULONG)~0,0,JAM1 | COMPLEMENT);
  355.     SetMaxPen(RPort,(ULONG)~0);
  356.  
  357.     RectFill(RPort,Window->BorderLeft + x*FontWidth,Window->BorderTop + y*FontHeight,Window->BorderLeft + x*FontWidth + FontWidth-1,Window->BorderTop + y*FontHeight + FontHeight-1);
  358.  
  359.     SetMaxPen(RPort,MaxPen);
  360.     SetABPenDrMd(RPort,FgPen,BgPen,JAM2);
  361. }
  362.  
  363. /******************************************************************************/
  364.  
  365. ULONG TextDisplay::WaitMask(VOID)
  366. {
  367.     return(WindowMask);
  368. }
  369.  
  370. LONG TextDisplay::Waiting(VOID)
  371. {
  372.     if(WaitingChar == -1)
  373.     {
  374.         struct IntuiMessage *Message;
  375.  
  376.         while(Message = (struct IntuiMessage *)GetMsg(WindowPort))
  377.         {
  378.             if(Message->Class == IDCMP_RAWKEY)
  379.             {
  380.                 if((WaitingChar = (WORD)MapKey(Message)) >= 0)
  381.                 {
  382.                     ReplyMsg((struct Message *)Message);
  383.  
  384.                     return(1);
  385.                 }
  386.             }
  387.             else
  388.             {
  389.                 if(Message->Class == IDCMP_CLOSEWINDOW)
  390.                 {
  391.                     ReplyMsg((struct Message *)Message);
  392.  
  393.                     WaitingChar = '\033';
  394.  
  395.                     return(1);
  396.                 }
  397.             }
  398.  
  399.             ReplyMsg((struct Message *)Message);
  400.         }
  401.  
  402.         return(0);
  403.     }
  404.     else
  405.         return(1);
  406. }
  407.  
  408. LONG TextDisplay::GetChar(VOID)
  409. {
  410.     if(WaitingChar == -1)
  411.     {
  412.         struct IntuiMessage *Message;
  413.  
  414.         while(Message = (struct IntuiMessage *)GetMsg(WindowPort))
  415.         {
  416.             if(Message->Class == IDCMP_RAWKEY)
  417.             {
  418.                 LONG Result = MapKey(Message);
  419.  
  420.                 ReplyMsg((struct Message *)Message);
  421.  
  422.                 return(Result);
  423.             }
  424.             else
  425.             {
  426.                 if(Message->Class == IDCMP_CLOSEWINDOW)
  427.                 {
  428.                     ReplyMsg((struct Message *)Message);
  429.  
  430.                     return('\033');
  431.                 }
  432.             }
  433.  
  434.             ReplyMsg((struct Message *)Message);
  435.         }
  436.  
  437.         return(-1);
  438.     }
  439.     else
  440.     {
  441.         LONG Result = WaitingChar;
  442.  
  443.         WaitingChar = -1;
  444.  
  445.         return(Result);
  446.     }
  447. }
  448.  
  449. LONG TextDisplay::MapKey(struct IntuiMessage *Message)
  450. {
  451.     static LONG Table[][2] =
  452.     {
  453.         RAWKEY_CursorUp,    KEY_CursorUp,
  454.         RAWKEY_CursorDown,    KEY_CursorDown,
  455.         RAWKEY_CursorRight, KEY_CursorRight,
  456.         RAWKEY_CursorLeft,    KEY_CursorLeft,
  457.  
  458.         RAWKEY_Help,        KEY_Help,
  459.  
  460.         RAWKEY_F1,            -1,
  461.         RAWKEY_F2,            -1,
  462.         RAWKEY_F3,            -1,
  463.         RAWKEY_F4,            -1,
  464.         RAWKEY_F5,            -1,
  465.         RAWKEY_F6,            -1,
  466.         RAWKEY_F7,            -1,
  467.         RAWKEY_F8,            -1,
  468.         RAWKEY_F9,            -1,
  469.         RAWKEY_F10,         -1,
  470.  
  471.         -1
  472.     };
  473.  
  474.     UBYTE Buffer[10];
  475.     LONG i;
  476.  
  477.     for(i = 0 ; Table[i][0] != -1 ; i++)
  478.     {
  479.         if((Message->Code & ~IECODE_UP_PREFIX) == Table[i][0])
  480.         {
  481.             if(Message->Code & IECODE_UP_PREFIX)
  482.                 return(-1);
  483.             else
  484.                 return(Table[i][1]);
  485.         }
  486.     }
  487.  
  488.     Event.ie_Class        = IECLASS_RAWKEY;
  489.     Event.ie_SubClass     = 0;
  490.     Event.ie_Code         = Message->Code;
  491.     Event.ie_Qualifier    = Message->Qualifier;
  492.     Event.ie_EventAddress = (APTR *) *((ULONG *)Message->IAddress);
  493.  
  494.     Buffer[0] = 0;
  495.  
  496.     if(MapRawKey(&Event,(char *)&Buffer[0],10,(struct KeyMap *)NULL) > 0)
  497.         return(Buffer[0]);
  498.     else
  499.         return(-1);
  500. }
  501.  
  502. VOID TextDisplay::PutChar(UBYTE c,int x,int y)
  503. {
  504.     Move(RPort,Window->BorderLeft + x * FontWidth,Window->BorderTop + y * FontHeight + RPort->TxBaseline);
  505.     Text(RPort,(STRPTR)&c,1);
  506. }
  507.